﻿using System;
using System.Web.UI;
using NguyenHoa.Web.App_Code;
using NguyenHoa.Services;

namespace NguyenHoa.Web.MasterPages
{
  public partial class Home : MasterPage
  {
    #region Events
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!Page.IsPostBack && !Page.IsCallback)
      {
        LoadSlideShow();
      }
    }

    protected void btnEN_Click(object sender, ImageClickEventArgs e)
    {
      ((BasePage)Page).CurrentLanguage = GlobalCache.Instance.English;
      Response.Redirect(Request.RawUrl);
    }

    protected void btnVN_Click(object sender, ImageClickEventArgs e)
    {
      ((BasePage)Page).CurrentLanguage = GlobalCache.Instance.Vietnamese;
      Response.Redirect(Request.RawUrl);
    }
    #endregion

    #region Methods
    private void LoadSlideShow()
    {
      rptSlideShow.DataSource = new MultimediaService().GetPhotoByType(MultimediaType.Banner);
      rptSlideShow.DataBind();
    }
    #endregion
  }
}
